<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button class="btn">新增</button>
    <button class="btn">获取</button>
    <button class="btn">修改</button>
    <button class="btn">删除全部</button>
</body>
<script>
    var btn = document.getElementsByClassName('btn')


    btn[0].onclick = function () {
        localStorage.setItem('name', '张三')
        localStorage.setItem('pwd', 'asd123')
        localStorage.setItem('phone', '15845201587')
        localStorage.setItem('email', 'a16da1@163.com')
    }

    btn[1].onclick = function () {
        console.log(localStorage.name)
        console.log(localStorage.getItem('pwd'))
        console.log(localStorage.getItem('phone'))
        console.log(localStorage.getItem('email'))
    }
    btn[2].onclick = function () {
        localStorage.setItem('name', '李四')
        localStorage.setItem('pwd', 'andiashodasodno')
        localStorage.setItem('phone', '15ANDOASD')
        localStorage.setItem('email', 'a1ASSAASADADASDASD@163.com')
    }
    btn[3].onclick = function () {
        localStorage.clear()
    }




</script>

</html>